package com.luo.bbs.front.webapi.controller;

import com.example.bbs.front.service.IAnnounceService;
import com.luo.common.restful.JsonResult;
import com.luo.pojo.Announce;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

@RestController
@Slf4j
@RequestMapping("/announce")
public class AnnounceController {
    @Autowired
    private IAnnounceService announceService;

    @GetMapping("/get")
    public JsonResult getAnnounce(){
        Announce announce = announceService.get();
        return JsonResult.ok(announce);
    }

    @PostMapping("/views/add/{id}")
    public JsonResult addViews(@PathVariable Integer id){
        announceService.addViews(id);
        return JsonResult.ok();
    }
}
